package ldkxingzhe.ldkxingzhedemo.service;

import android.app.IntentService;
import android.content.Intent;
import android.os.SystemClock;
import android.support.v4.content.LocalBroadcastManager;

import ldkxingzhe.ldkxingzhedemo.utils.LogDemo;

/**
 * Created by ke on 15-9-18.
 */
public class NoticeIntentService extends IntentService{

    private final static String TAG = NoticeIntentService.class.getSimpleName();

    public static String BROADCAST = NoticeIntentService.class.getName();
    private static Intent INTENT = new Intent(BROADCAST);
    /**
     * Creates an IntentService.  Invoked by your subclass's constructor.
     *
     * @param name Used to name the worker thread, important only for debugging.
     */
    public NoticeIntentService(String name) {
        super(name);
    }

    public NoticeIntentService(){
        this(TAG);
    }

    @Override
    protected void onHandleIntent(Intent intent) {
        LogDemo.v(TAG,"onHandleIntent");
        SystemClock.sleep(5000);
        LocalBroadcastManager.getInstance(this).sendBroadcast(INTENT);
    }
}
